package com.dream.plugin.simpledao.util;

import java.io.Serializable;
import java.util.List;

public class SPage implements Serializable {

    // 当前页数,从1开始
    private Integer currentPage;

    // 总页数
    private Integer totalPage;

    // 当前页的元素数量
    private Integer pageSize;

    // 每页的最大数量
    private Integer maxSize;

    // 内容
    private List<Object> content;

    public SPage(Integer currentPage, Integer totalPage, Integer maxSize, List<Object> content) {
        this.currentPage = currentPage;
        this.totalPage = totalPage;
        this.maxSize = maxSize;
        this.content = content;
        this.pageSize = content == null ? 0 : content.size();
    }

    @Override
    public String toString() {
        return "SPage{" +
                "currentPage=" + currentPage +
                ", totalPage=" + totalPage +
                ", pageSize=" + pageSize +
                ", maxSize=" + maxSize +
                ", content=" + content +
                '}';
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public SPage setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
        return this;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public SPage setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
        return this;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public SPage setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
        return this;
    }

    public Integer getMaxSize() {
        return maxSize;
    }

    public SPage setMaxSize(Integer maxSize) {
        this.maxSize = maxSize;
        return this;
    }

    public List<Object> getContent() {
        return content;
    }

    public SPage setContent(List<Object> content) {
        this.content = content;
        return this;
    }
}
